package com.kyh.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class TxtUtil {
	
	public static void main(String[] args) {
		String filename = "C:\\Users\\Administrator\\Desktop\\2.txt";
		toArrayByFileReader1(filename);
	}

	public static void toArrayByFileReader1(String name) {
		try {
			FileReader fr = new FileReader(name);
			BufferedReader bf = new BufferedReader(fr);
			String str;
			// 按行读取字符串
			while ((str = bf.readLine()) != null) {
				System.out.println(str);
			}
			bf.close();
			fr.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
